<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,user-scalable=no,minimal-ui">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../img/asset-favico.ico">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <title>健康干预</title>

    <link rel="stylesheet" href="../css/page-health-intervention.css" />
</head>

<body data-spy="scroll" data-target="#myNavbar" data-offset="150">
    <div class="app">
        <!-- 页面头部 -->
        <div class="top-header">
            <span class="f-left"><i class="icon-back"></i>返回</span>
            <span class="center">传智健康</span>
            <span class="f-right"><i class="icon-more"></i></span>
        </div>
        <div id="app">
            <div class="box ordersetting">
                <el-card class="box-card">
                    <div class="boxMain">

                        <el-upload action="/health/upload.do"
                                   name="multipartFile"
                                   :show-file-list="false"
                                   :on-success="handleSuccess"
                                   :before-upload="beforeUpload">
                            <el-button type="primary">上传体检</el-button>
                        </el-upload>
                    </div>
                </el-card>
            </div>
        </div>
        <!--<form action="/health/upload.do" method="post" enctype="multipart/form-data">-->
            <!--<input name="username">-->
            <!--<input type="file" name="multipartFile">-->
            <!--<input type="submit" value="提交">-->
        <!--</form>-->
        <!--<form action="/health/upload.do" method="post" enctype="multipart/form-data">-->
            <!--<input id="textId" type="text"><br/>-->
            <!--<input  type="file" name="multipartFile">-->
            <!--<input type="submit" value="提交">-->
            <!--<input type="button" value="查询" onclick="serach();">-->
        <!--</form>-->
        <!-- 页面内容 -->
        <div class="contentBox">
            <div class="tab-wrapper">
                <ul class="tab-menu">
                    <li class="active">运动方案</li>
                    <li>膳食方案</li>
                    <li>干预计划</li>
                </ul>
                <div class="tab-content">
                    <div class="item">
                        <div class="intro-img">
                            <img src="../img/widget-info02.png" width="100%" />
                        </div>
                        <div class="table-title">
                            <span>运动名称</span>
                            <span>运动时间</span>
                            <span>运动频率</span>
                            <span>卡路里</span>
                        </div>
                        <table class="table" border="0" cellspacing="0" cellpadding="0">
                            <tbody id="tbody">

                            </tbody>
                        </table>

                    </div>


                </div>
            </div>
        </div>
    </div>
    <!-- 页面 css js -->
    <script src="../js/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script src="../js/axios-0.18.0.js"></script>
    <script src="../plugins/jquery/dist/jquery.min.js"></script>
    <script src="../js/page-health-intervention.js"></script>
<script>
    function serach() {
     var value = $("#textId")[0].value;
     $.post("/health/serach.do","condition="+value,function(data){

             $("#tbody").empty();
         var tr;
            $.each(data,function (index,element) {
                tr+=`<tr><td>${element.name}</td>
                        <td>${element.runtime}</td>
                        <td>${element.ecount}</td>
                        <td>${element.kmCon}</td></tr>
                       `;

                // alert(JSON.stringify(element));
                // alert(tr)

                
            })
         $("#tbody").append(tr)

     },"json")
    }
    // $(
    //     $.post("/health/do.do?")
    // )
</script>
<script>
    var vue=new Vue({
        el:"#app",
        methods:{
            beforeUpload(file){
                const isXLS = file.type === 'application/vnd.ms-excel';
                if(isXLS){
                    return true;
                }
                const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
                if (isXLSX) {
                    return true;
                }
                this.$message.error('上传文件只能是xls或者xlsx格式!');
                return false;
            },
            handleSuccess(response, file) {

                $("#tbody").empty();
                var tr;
                $.each(response,function (index,element) {
                    tr+=`<tr><td>${element.name}</td>
                        <td>${element.runtime}</td>
                        <td>${element.ecount}</td>
                        <td>${element.kmCon}</td></tr>
                       `;

                    // alert(JSON.stringify(element));
                    // alert(tr)


                })
                $("#tbody").append(tr)
            },
        }
    })
</script>
</body>